<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="referrer" content="no-referrer">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>网络收藏夹|富文本编辑器</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="content"></div>
<script type="text/javascript" src="layui/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="layui/wangEditor.min.js"></script>
<script type="text/javascript">
    var E = window.wangEditor;
    var editor = new E('#content');
    editor.config.height = 300;
    editor.config.showFullScreen = false;
    editor.config.placeholder = '记录这一刻，晒给懂你的人'
    editor.create();

    // 编辑
    var url = window.location.href;
    if(url.lastIndexOf("#") > 0){
        var momentId = url.substring(url.lastIndexOf("#") + 1);
        $.ajax({
            type: "GET",
            url: "moment/" + momentId,
            dataType: "json",
            success: function (result) {
                if (result.code == 0 && result.data) {
                    editor.txt.html(result.data.content);
                }
            }
        });
    }
</script>
</body>
</html>
